<!DOCTYPE html>
<html> 
<head> 
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>超标车型</title> 
    <link rel="shortcut icon" href="favicon.ico">
	<#import "/common/import.ftl" as import>
    <@import.tableManagerImportCss/>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <!-- Panel Other -->
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>超标车型信息</h5>
                <div class="ibox-tools">
                </div>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">  
                    <div class="col-sm-12">
                        <!-- Example Events -->
                        <div class="example-wrap"> 
                            <div class="example"> 
	                            <div class="btn-group hidden-xs" id="exampleTableEventsToolbar" role="group">
	                                <@menuCheckInfo url = "/reg/excessivemodels/save.do">
                                	<#if urlCheck == true>
                                    <button type="button" class="btn btn-outline btn-default" data-toggle="modal" id="add" data-target="#userModal">
                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>&nbsp;&nbsp;新增
                                    </button>
                                    </#if>
                                    </@menuCheckInfo>
                                     <@menuCheckInfo url = "/reg/excessivemodels/edit.do">
                                	<#if urlCheck == true>
                                    <button type="button" class="btn btn-outline btn-default" id="edit" >
                                        <i class="glyphicon glyphicon-edit" aria-hidden="true"></i>&nbsp;&nbsp;修改
                                    </button>
                                     </#if>
                                    </@menuCheckInfo>
                                     <@menuCheckInfo url = "/reg/excessivemodels/remove.do">
                                	<#if urlCheck == true>
                                    <button type="button" class="btn btn-outline btn-default" id="del">
                                        <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>&nbsp;&nbsp;删除
                                    </button> 
                                    </#if>
                                    </@menuCheckInfo>
                                </div>
                                <table id="exampleTableEvents" data-mobile-responsive="true" >
                                    <thead>
                                        <tr>
                                            <th data-field="state" data-radio="true"></th>  
                                            <th data-field="id" data-visible = "false" >id</th>  
								            <th data-field="clpp">车辆品牌</th> 
								            <th data-field="clxh">车辆型号</th>
								            <th data-field="clsccj">车辆生产厂家</th> 
								            <th data-field="jccls">检测车辆数</th>
								            <th data-field="cbcls">检测车辆数</th>
								            <th data-field="cjsj" data-formatter="formatTime">创建时间</th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                        <!-- End Example Events -->
                    </div>
                </div>
            </div>
        </div>
        <!-- End Panel Other -->
    </div>
    
    <div id="win_add"></div>
	<div id="win_edit"></div>
	<div id="win_set"></div>
    <@import.tableManagerImportScript/>
    <script src="${WEB_PATH}/resources/js/plugins/jsTree/jstree.min.js"></script>
    <script src="${WEB_PATH }/resources/js/plugins/fancybox/jquery.fancybox.js"></script>
    <script src="${WEB_PATH}/resources/js/qcity-picker.data.js"></script>
	<script src="${WEB_PATH}/resources/js/city-picker.js"></script>
    <script >
    	$(function(){
    	
    		function queryParams(params) {
		        var temp = {  
			        limit: params.limit,  
			        offset: params.offset,  
			        search:params.search,
			        maxrows: params.limit,
			        pageindex:params.pageNumber,
		        };
		        return temp;
			}
    		//加载table数据
	    	$("#exampleTableEvents").bootstrapTable({
	            url: "${WEB_PATH }/reg/excessivemodels/getPage.do",
	            method: 'get',
	            search:true,
	            pagination:true,
	            pageNumber:1,  
	            pageSize:15,   
	            showRefresh:true, 
	            showColumns:true,
	            detailView:true,
	            detailFormatter:detailFormatter,
	            iconSize: "outline",
	            toolbar: "#exampleTableEventsToolbar",
	            sidePagination: "server", //设置为服务器端分页
	            queryParams: queryParams,//参数
	            minimumCountColumns: 1, 
	            search: true,    //隐藏搜索框
	            clickToSelect: true,  
	        });
	        
	        function detailFormatter(index, row) {
	        	var html = "<div class='row'><p class='col-md-12' style='text-align: center;'>备注："+row.bz+"</p></div>"
			    return html;
			}
	        
	        $('input.form-control.input-outline').attr("placeholder","输入品牌或型号检索"); //设置搜索提示信息
	        $('#del').click(function () {
	        	var selectRow = $("#exampleTableEvents").bootstrapTable('getSelections');
	        	var info = selectRow[0]; 
	        	if(0 == selectRow.length){
				    layer.msg('<font color="red">温馨提示：请选择一条记录删除。</font>', {icon: 5}); 
				    return ;
	        	}
	        	
	        	layer.confirm('<span style="color: red">您确定要删除该数据?</span>',{icon: 3, title:'系统提示',btn: ['确认','取消']},
	    		function(){
	        		$.yilinAjax({
					   	  	 type:'POST',
					   	  	 url:'${WEB_PATH }/reg/excessivemodels/remove.do?ID=' + info.id,
					   	  	 data:null,
		            		 errorcallback:null,
		            		 btn:null,
		            		 successcallback:success
				   });
				});
			});
        });
        //加载添加页面
        $('#add').click(function(){
        	$("#win_add").load("${WEB_PATH }/reg/excessivemodels/view/add.do");
        });
        //加载修改页面
        $("#edit").click(function(){
        	var selectRow = $("#exampleTableEvents").bootstrapTable('getSelections');
	        if(1 != selectRow.length){
			    layer.msg('<font color="red">温馨提示：请选择一条数据编辑。</font>', {icon: 5}); 
			    return ;
	       	}
	       	var info = selectRow[0];  
	       	$("#win_edit").load("${WEB_PATH }/reg/excessivemodels/view/edit.do?id="+info.id);
        });
		
		function success(result) {
			if(result.success == true){
				swal("删除成功！", "您已经永久删除来该数据。", "success")
				$("button[name='refresh']").trigger("click");
			}else{
				swal("删除成功！", "您已经永久删除了该数据。", "success")
			}
		}
		
        function formatTime(val){
		 	var tt=new Date(val).toLocaleString(); 
    		return tt; 
		}
    </script>
</body>

</html>